package com.wksc.framework.impexp.constants;

import com.wksc.framework.impexp.util.ClassFactory;

/**
 * <p> Title(文件名): TaskStat.java </p>
 * <p> Description(描述): 任务运行状态的枚举常量 </p>
 * <p> Copyright(版权): Copyright (c) 2011 </p>
 * <p> Company(公司): 成都四方信息技术有限公司 </p>
 * <p> CreateTime(生成日期)：2011-10-26下午07:25:24 </p>
 * @author wanglei
 * @version impExp_C13
 */
public enum TaskStat {
	TASK_CREATED(ClassFactory.getI18n().getStateCreate()){
		@Override
		public int toInt() {
			return 0;
		}

        @Override
        public byte toByte() {
            return (byte)0;
        }
	},
	TASK_WAITING(ClassFactory.getI18n().getStateWait()) {
		@Override
		public int toInt() {
			return 1;
		}

        @Override
        public byte toByte() {
            return (byte)1;
        }
	},
	TASK_RUNNING(ClassFactory.getI18n().getStateRun()) {
		@Override
		public int toInt() {
			return 2;
		}

        @Override
        public byte toByte() {
            return (byte)2;
        }
	},
	TASK_PAUSED(ClassFactory.getI18n().getStatePause()) {
		@Override
		public int toInt() {
			return 4;
		}

        @Override
        public byte toByte() {
            return (byte)4;
        }
	},
	TASK_RESUME(ClassFactory.getI18n().getStateResume()) {
		@Override
		public int toInt() {
			return 6;
		}

        @Override
        public byte toByte() {
            return (byte)6;
        }
	},
	TASK_CANCELLING(ClassFactory.getI18n().getStateCancel()) {
		@Override
		public int toInt() {
			return 7;
		}

        @Override
        public byte toByte() {
            return (byte)7;
        }
	},
	TASK_RELOADED(ClassFactory.getI18n().getStateReload()) {
		@Override
		public int toInt() {
			return 8;
		}

        @Override
        public byte toByte() {
            return (byte)8;
        }
	},
	TASK_FINISHED(ClassFactory.getI18n().getStateFinish()){
		@Override
		public int toInt() {
			return 3;
		}

        @Override
        public byte toByte() {
            return (byte)3;
        }
	},
	TASK_EXCEPTION(ClassFactory.getI18n().getStateException()){
		@Override
		public int toInt() {
			return 5;
		}

        @Override
        public byte toByte() {
            return (byte)5;
        }
	},
	TASK_CANCELLED(ClassFactory.getI18n().getStateCancelled()) {
		@Override
		public int toInt() {
			return 9;
		}

        @Override
        public byte toByte() {
            return (byte)9;
        }
	};
	
	/**任务的执行状态*/
	private String taskStat;
	
	TaskStat(String taskStat){
		this.taskStat = taskStat;
	}

	/**
	 * 方法描述：获取任务状态的int表示值,每个状态重写此方法
	 *
	 * @creator wanglei
	 * @return
	 */
	public abstract int toInt();

    public abstract byte toByte();
	
	@Override
	public String toString() {
		return taskStat;
	}
	
	public String getTaskStat() {
		return taskStat;
	}

	public void setTaskStat(String taskStat) {
		this.taskStat = taskStat;
	}
}
